package com.sun.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.sun.entity.Time;
import com.sun.mapper.TimeMapper;
import com.sun.service.ITimeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 清风
 * @since 2022-03-30
 */
@Service
@Primary
public class TimeServiceImpl extends ServiceImpl<TimeMapper, Time> implements ITimeService {

    @Autowired
    private TimeMapper timeMapper;

    @Override
    public int updateTimeForCreateTime() {
        UpdateWrapper<Time> wrapper = new UpdateWrapper<>();
        wrapper.eq("static_value", 0).gt("create_time",new Date());
        Time user= new Time();
        user.setStaticValue(2);
        return timeMapper.update(user, wrapper);
    }
}
